package 线程和TCP网络编程.TAKS2.Socket;

import java.io.IOException;
import java.net.Socket;
import java.util.Scanner;

/**
 * 客户端对象封装类
 *
 * @author 君未洋
 */
public class SocketClient {
    public static void newClient() throws IOException {
        Socket socket = new Socket("127.0.0.1", 9999);
        System.out.println("恭喜你连接成功!");
        System.out.println("请输入您的用户名");
        String name = new Scanner(System.in).next();
        System.out.println("--------进入聊天室---------");
        new Thread(new SocketInputThread(socket, name)).start();
        new Thread(new SocketOutputThread(socket)).start();
    }
}
